import { DataTypes } from 'sequelize';
import sequelize from '../config/db.config.js';

const FamilyTree = sequelize.define('FamilyTree', {
  id: {
    type: DataTypes.INTEGER,
    primaryKey: true,
    autoIncrement: true,
    field: 'family_tree_id'
  },
  userId: {
    type: DataTypes.INTEGER,
    allowNull: false,
    references: {
      model: 'users',
      key: 'user_id'
    },
    field: 'user_id'
  },
  name: {
    type: DataTypes.STRING(100),
    allowNull: false,
    field: 'name'
  },
  description: {
    type: DataTypes.TEXT,
    allowNull: true,
    field: 'description'
  }
}, {
  tableName: 'family_trees',
  timestamps: true,
  paranoid: true,
  deletedAt: 'deleted_at'
});

export default FamilyTree; 